call :deleteAll tmp
for %%i in (proto/*.proto) do lib\protoc.exe --proto_path=./proto proto/%%i --include_imports --descriptor_set_out=tmp/%%i.pb

call :deleteAll cs_src
for %%i in (tmp/*.pb) do lib\protogen.exe tmp/%%i -output_directory=cs_src

call :deleteAll cs_final
for %%i in (cs_src/*.cs) do c:\Python27\python lib/parse_proto.py cs_src/%%i cs_final/%%i

::call :deleteAll java
::for %%i in (proto/*.proto) do lib\protoc.exe --proto_path=./proto proto/%%i --java_out=./java

ruby protobuf_magician
ruby error_code
move build\netmsg_id.cs cs_final\
move build\netmsg_str.cs cs_final\
move build\netmsg_json.cs cs_final\
del cs_final\CSharpOptions.cs
del cs_final\DescriptorProtoFile.cs
::copy cs_final\* ..\client\src\Assets\Vendor\net_msg /Y

goto :end

:deleteAll
setlocal
if exist %1 (for %%i in (%1/*) do del %1\%%i)
if not exist %1 (md %1)
endlocal&goto :EOF

:end
pause
